package cn.fuhao.springboot.demo.controller;

import cn.fuhao.springboot.demo.config.Config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class ConfigInfoController {

    @Value("${boot.name}")
    private String name;

    @Value("${boot.birthday}")
    private String birthday;

    @Autowired
    private Config config;

    @RequestMapping("/configInfo")
    public @ResponseBody String configInfo(){
        return config.getName()+":" + config.getBirthday();
    }

//    @RequestMapping("/configInfo")
//    public @ResponseBody String configInfo(){
//        return name+":" + birthday;
//    }

}
